<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Bootstrap Material Admin</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/4.2.1/css/bootstrap.min.css">
    <link rel="stylesheet" th:href="@{/css/loginAndRegist.css}" id="theme-stylesheet">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <link rel="stylesheet"  th:href = "@{/plugins/xcConfirm/xcConfirm.css}">
    <script th:src = "@{/plugins/xcConfirm/xcConfirm.js}"></script>
    <script>
      function getUrlParms(name){
        //获得页面url的某个url参数的方法
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)
          return unescape(r[2]);
        return null;
      }
      var id = getUrlParms("rslt");
      // console.log(id);
      if(id=="1"){
        $(function () {
          var txt=  "用户名或密码错误";
          // console.log(txt);
          // window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
          alert(txt);
          $("#login-password").removeClass("form-control is-valid")
          $("#login-password").addClass("form-control is-invalid");
        })
      }




    </script>

  </head>
  <body>
    <div class="page login-page">
      <div class="container d-flex align-items-center">
        <div class="form-holder has-shadow">
          <div class="row">
            <!-- Form Panel    -->
            <div class="col-lg-12 bg-white">
              <div class="form d-flex align-items-center">
                <div class="content">
                  <form method="post" th:action="@{/user/dologin}" class="form-validate" id="loginFrom">
                    <div class="form-group">
                      <input id="login-username" type="text" name="adminname" required data-msg="请输入用户名" placeholder="用户名"  class="input-material">
                    </div>
                    <div class="form-group">
                      <input id="login-password" type="password" name="password" required data-msg="请输入密码" placeholder="密码" class="input-material">
                      <div class="invalid-feedback">
                        账号或密码错误
                      </div>
                    </div>
                    <input id="login" type="submit" class="btn btn-primary" value="登录"/>
                    <!--<div style="margin-top: -40px;">
                    	&lt;!&ndash; <input type="checkbox"  id="check1"/>&nbsp;<span>记住密码</span>
                    	<input type="checkbox" id="check2"/>&nbsp;<span>自动登录</span> &ndash;&gt;
                    	<div class="custom-control custom-checkbox " style="float: right;">
											    <input type="checkbox" class="custom-control-input" id="check2" >
											    <label class="custom-control-label" for="check2">自动登录</label>
											</div>
											<div class="custom-control custom-checkbox " style="float: right;">
											    <input type="checkbox" class="custom-control-input" id="check1" >
											    <label class="custom-control-label" for="check1">记住密码&nbsp;&nbsp;</label>
											</div> 
                    </div>-->
                  </form>
                  <br />
                  <small>没有账号?</small><a th:href="@{/user/register}" class="signup">&nbsp;注册</a>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- JavaScript files-->
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <!--表单验证-->
    <script th:src="@{/js/jquery.validate.min.js}"></script>
    <!-- Main File-->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script th:src="@{/js/front.js}"></script>
    <script>
    	$(function(){
    		/*判断上次是否勾选记住密码和自动登录*/
    		/*var check1s=localStorage.getItem("check1");
    		var check2s=localStorage.getItem("check2");
    		var oldName=localStorage.getItem("userName");
    		var oldPass=localStorage.getItem("passWord");
    		if(check1s=="true"){
    			 $("#login-username").val(oldName);
    			 $("#login-password").val(oldPass);
    			 $("#check1").prop('checked',true);
    		}else{
    			 $("#login-username").val('');
    			 $("#login-password").val('');
    			 $("#check1").prop('checked',false);
    		}
    		if(check2s=="true"){
    			$("#check2").prop('checked',true);
    			$("#loginFrom").submit();
    			//location="https://www.baidu.com?userName="+oldName+"&passWord="+oldPass;//添加退出当前账号功能
    		}else{
    			$("#check2").prop('checked',false);
    		}*/

    		/*拿到刚刚注册的账号*/
    		/*if(localStorage.getItem("adminname")!=null){
    			$("#login-username").val(localStorage.getItem("adminname"));
    		}*/

    		/*登录*/

    		/*$("#login").click(function(){
    			var userName=$("#login-username").val();
    			var passWord=$("#login-password").val();
    			/!*获取当前输入的账号密码*!/
    			localStorage.setItem("userName",userName)
    			localStorage.setItem("passWord",passWord)
    			/!*获取记住密码  自动登录的 checkbox的值*!/
    			var check1 = $("#check1").prop('checked');
	    		var check2 = $('#check2').prop('checked');
	    		localStorage.setItem("check1",check1);
	    		localStorage.setItem("check2",check2);
    		})*/


    		/*$("#check2").click(function(){
    			var flag=$('#check2').prop('checked');
    			if(flag){
    				var userName=$("#login-username").val();
	    			var passWord=$("#login-password").val();
	    			$.ajax({
	    				type:"post",
                        url:"[(@{/user/login})]",
	    				data:{"userName":userName,"passWord":passWord},
	    				async:true,
	    				success:function(res){
	    					console.log("result:"+res);
	    				}
	    			});
    			}
    		})*/

    	})
    </script>
  </body>
</html>